package com.springcloud.server.controller;

import com.springcloud.api.entries.Dept;
import com.springcloud.server.server.DeptServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author tiansongtao
 * @date 2019年04月11日-17时17分
 */
@RestController
public class DeptController {

    @Autowired
    private DeptServer deptServer;

    @RequestMapping(value = "/dept/add", method = RequestMethod.POST)
    public boolean addDept(Dept dept) {
        return deptServer.addDept(dept);
    }

    @GetMapping(value = "/dept/get/{id}")
    public Dept getById(@PathVariable("id") Long id) {
        return deptServer.getById(id);
    }

    @GetMapping(value = "/dept/getall")
    public List<Dept> getAll(){
        return deptServer.getAllDept();
    }
}